package com.woniuxy.main.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.main.pojo.Student_coach;

public interface Student_coachMapper {

	//生成请求
	@Insert("insert into student_coach(sid,cid,createDate) values(#{sid},#{cid},#{createDate})")
	public int insertRequest(Student_coach student_coach);
	
	//检查用户是否已发送过请求
	@Select("select * from student_coach where sid=#{sid} and cid=#{cid}")
	public Student_coach isSendRequest(@Param("sid")int sid, @Param("cid")int cid);
	
	//更新未处理的请求
	@Update("update student_coach set createDate=#{createDate} where sid=#{sid} and cid=#{cid} and status='等待处理'")
	public int updateRequest(Student_coach student_coach);
	
	//查询申请状态
	@Select("select status from student_coach where sid=#{sid} and cid=#{cid}")
	public String requestStatus(Student_coach student_coach);
	
	//取消申请
	@Delete("delete from student_coach where sid=#{sid} and cid=#{cid}")
	public int deleteRequest(Student_coach student_coach);

}
